
<html><HEAD>
<LINK REL=STYLESHEET HREF="default.css" TYPE="text/css">
<TITLE>
Using the Code Examples application</TITLE>
</HEAD>
<BODY>

<!-- Header -->
<p class="ancestor" align="right"><A HREF="apptechp6.htm">Previous</A>&nbsp;&nbsp;<A HREF="apptechp8.htm" >Next</A>
<!-- End Header -->
<A NAME="CCJBABDG"></A><h1>Using the Code Examples application</h1>
<A NAME="TI74"></A><p>You run the Code Examples application from the development
environment. </p>
<A NAME="TI75"></A><p><img src="images/proc.gif" width=17 height=17 border=0 align="bottom" alt="Steps"> To run the Code Examples application:</p>
<ol><li class=fi><p>Select File&gt;New from the menu
bar, select Workspace from the Workspace tab, and click OK.</p></li>
<li class=ds><p>Navigate to the <i>PowerBuilder 11.5\Code
Examples\Example App</i> folder, type a name for
the workspace, and click Save.</p></li>
<li class=ds><p>Select Add Target from the pop-up menu for the
workspace you just created, navigate to the <i>PowerBuilder
11.5\Code Examples\Example App</i> folder,
select the <i>PB Examples</i> target file, and click
Open.</p><p>If you expand the target, you will see that the <ACRONYM title = "pibble" >PBL</ACRONYM> that contains the application
and all its supporting <ACRONYM title = "pibbles" >PBLs </ACRONYM>have
been added to the workspace.</p></li>
<li class=ds><p>Click the Run button on the PowerBar.</p></li></ol>
<br><A NAME="CCJDADAC"></A><h2>Browsing the examples</h2>
<A NAME="TI76"></A><p>When the Code Examples application opens, the left pane contains
an expandable tree view listing the categories of examples available.
Some examples appear in more than one category. For example, the
Business Class example is listed under Inheritance and User Objects.
If you are looking for examples showing how to work with a specific
feature, such as DataStores or DataWindows, expand that category
and look at the example names. </p>
<A NAME="TI77"></A><p>When you select an example in the left pane, a description
of the example and the techniques it demonstrates displays on the
right: </p>
<br><img src="images/codex01.gif">
<A NAME="CCJDFHEH"></A><h2>Finding examples</h2>
<A NAME="TI78"></A><p>If you are looking for ways to work with a specific PowerBuilder
object class or feature, you can use the categories in the Examples
pane and the descriptions to locate examples. If you are looking
for examples using a specific event, function, or user-defined object,
use the Search pane. </p>
<A NAME="TI79"></A><p><img src="images/proc.gif" width=17 height=17 border=0 align="bottom" alt="Steps"> To search for a function, event, or object:</p>
<ol><li class=fi><p>Click the Search tab in the Code Examples
main window.</p></li>
<li class=ds><p>Select a radio button in the Search On group box. </p></li>
<li class=ds><p>Select the item you want in the drop-down list
and click Perform Search.</p><p>The names of all the examples that use the function, event,
or object you searched for display:</p><br><img src="images/codex02.gif"><br>
</li></ol>
<br><A NAME="CCJEAADH"></A><h2>Running and examining examples</h2>
<A NAME="TI80"></A><p>Once you have located an example that performs some processing
you want to learn about, you can run it to examine how it works
and look at the code (and copy it if you want to).</p>
<A NAME="TI81"></A><h4>Running an example</h4>
<A NAME="TI82"></A><p>To run the highlighted example, double-click it or click Run!.
You can get Help on how to use the example and what it does by clicking
the Help button on the example's main window. </p>
<A NAME="TI83"></A><h4>Examining the code</h4>
<A NAME="TI84"></A><p>To see all the objects used in an example, click the Related
Objects tab on the right pane and click the plus signs to expand
items:</p>
<br><img src="images/codexo3.gif">
<A NAME="TI85"></A><p>Double-click the icon for a script or function to examine
it.</p>
<A NAME="TI86"></A><h4>Using examples in the development environment</h4>
<A NAME="TI87"></A><p>Running the Code Examples application and looking at the code
for an example gives you a lot of information, but if you open objects
in the examples in the development environment, you can examine
them in more depth.</p>
<A NAME="TI88"></A><p>For example, you can open any object in a painter, examine
the inheritance hierarchy in the Browser, and step through an example
in the Debugger. You can even copy objects to your own application
in the Library painter or copy code fragments to the Script view.</p>
<A NAME="TI89"></A><p>The libraries in the Code Examples application are organized
by object type. For example, <i>pbexamd1.pbl</i> and <i>pbexamd2.pbl</i> contain
DataWindow objects. This makes it easy to find the objects that
are referenced as examples later in this book. If you expand the
sample libraries in the List view in the Library painter, the comments
tell you what each object is used for.</p>

